#include <iostream>
#include <string>
#include <map>
#include <unordered_map>

using namespace std;

int main()
{

    // declaration container and iterator
    unordered_map<string, string> mapStudent;
    unordered_map<string, string>::iterator iter;

    // insert element
    // if insert the same key, can't replace this key homologous value;
    mapStudent.insert(pair<string, string>("r000", "student_zero"));
    mapStudent.insert(map<string, string>::value_type("r777", "smitish"));
    mapStudent["r123"] = "student_first";
    mapStudent["r456"] = "student_second";

    // traversal
    cout << "for iterator traversal" << endl;
    for (iter = mapStudent.begin(); iter != mapStudent.end(); iter++)
        cout << "k:" << iter->first << " v:" << iter->second << endl;

    // find and erase the element
    iter = mapStudent.find("r123");
    mapStudent.erase(iter);
    
    cout << mapStudent.max_size() << endl;


    iter = mapStudent.find("r123");
    if (iter != mapStudent.end())
        cout << "Find, the value is " << iter->second << endl;
    else
        cout << "Do not Find" << endl;

    return 0;
}